<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <meta name="author" content="">
    <title></title>  <link rel="icon" href="/template/pc1/images/wmh_favicon.ico" type="image/x-icon" />
    <% include("../inc/list_css.html"){}%>
</head>
<body>
<div class="ibox ">
    <div class="ibox-title">
        <div class="pull-left mbx navbar_title">
            <span>订单管理 </span>
            <span class="line">/</span>
            待收货
        </div>
    </div>

    <div class="ibox-content">
        <div class="wrapper wrapper-content">
            <div class="row">
                <div class="col-md-12">

                    <table data-toggle="table " id="table" data-show-export="true" class=" table-striped table-no-bordered fixed-table-container table-row-border-color table-hovered table-hover">
                        <thead class="table-header">
                        <tr>
                            <th data-field="orderSn">订单编号</th>
                            <th data-field="trade_no">第三方流水号</th>
                            <th data-field="code">会员编号</th>
                            <th data-field="username">昵称</th>
                            <th data-field="shipName">收件人</th>
                            <th data-field="" data-formatter="addressFormatter">收件人地址</th>
                            <th data-field="productTotalQuantity">订单数量</th>
                            <th data-field="orderDetail" >商品</th>
                            <th data-field="totalAmount">订单总额</th>
                            <th data-field="paymentStatus" data-formatter="paymentStatusF">付款状态</th>
                            <!--<th data-field="shippingStatus" data-formatter="shippingStatusF">配送状态</th>-->
                            <th data-field="paymentConfigName">支付方式</th>
                            <!--<th data-field="deliveryTypeName">配送方式</th>-->
                            <th data-field="createDate">下单时间</th>
                            <th data-field="head" data-formatter="headFormatter">操作</th>
                        </tr>
                        </thead>
                    </table>

                </div>
            </div>
        </div>
    </div>
</div>


<% include("../inc/list_js.html"){}%>
<script>
    //收件人地址转换
    function addressFormatter(value, row, index) {
        return row.shipArea+'&nbsp;&nbsp;'+row.shipAddress;
    }
    //支付状态:0-未支付,1-部分支付,2-已支付,3-部分退款,4-全额退款
    function paymentStatusF(v) {
        if(v == 0){
            return "未支付";
        }else if(v == 1){
            return "部分支付";
        }else if(v == 2){
            return "已支付";
        }else if(v == 3){
            return "部分退款";
        }else if(v == 4){
            return "全额退款";
        }
    }
    //物流状态:0-未发货,1-部分发货,2-已发货,3-部分退货,4-已退货
    function shippingStatusF(v) {
        if(v == 0){
            return "未发货";
        }else if(v == 1){
            return "部分发货";
        }else if(v == 2){
            return "已发货";
        }else if(v == 3){
            return "部分退货";
        }else if(v == 4){
            return "已退货";
        }
    }

    function headFormatter(value, row, index){
        var html = '<a class="am-text-secondary" href="view?orders.id='+row.id+'" title="查看">[查 看]</a>';
        if ((row.orderStatus != 2) && (row.orderStatus != 3) && (row.paymentStatus == 0) && (row.shippingStatus == 0)){
            html += '<a class="am-text-secondary" href="${base}/order/edit?orders.id='+row.id+'" title="编辑">[编 辑]</a>';
        }
        html += '<a class="am-text-secondary" href="process?orders.id='+row.id+'&type=wl" title="处理">[处 理]</a>';
//        html += '<a class="am-text-secondary" onclick="test()" title="物流">[物 流]</a>';
        html += '<a class="am-text-secondary" href="/mall/admin/logistics/getLogisticsStatus?orders.id='+row.id+'" title="物流">[物 流]</a>';
        //html += '<a class="am-text-secondary" target="_blank" href="/mall/admin/logistics/receipts?orders.id='+row.id+'" title="单据">[单 据]</a>';
        return html;
    }

    function test() {
        location.href="/mall/admin/logistics/getLogisticsStatus";
//        https://dev.9hive.cn/mall/admin/orderManage/view?orders.id=b53dc8ee62b84aa280a0c71f03186e48
//        https://dev.9hive.cn/mall/admin/logistics/getLogisticsStatus
    }

    function stateFormatter(value){
        if(value){
            return "锁定";
        }else{
            return "正常";
        }
    }

    function queryParams() {
        var params = {};
        $('#toolbar').find('input[name]').each(function () {
            params[$(this).attr('name')] = $(this).val();
        });
        $('#toolbar').find('select').each(function () {
            params[$(this).attr('name')] = $(this).val();
        });
        return params;
    }
    /**
     * 加载页面数据
     * */
    (function () {

        $('#table').bootstrapTable({
            url: "ajaxlist?status=dsh",
            dataType: 'json',
            contentType: 'application/json',
            search: true,
            searchAlign: 'right',
            pagination: true,
            showRefresh: true,
            pageSize: 20,
            showToggle: false,//是否显示card/table切换按钮
            showColumns: true,//是否显示内容列下拉框
            pageList: [20, 50, 100],
            iconSize: 'outline',
            toolbar: '#eventsToolbar',
            paginationHAlign: 'right', //right, left
            paginationVAlign: 'bottom',
            icons: {
                refresh: 'icon-refresh',
                toggle: 'glyphicon-list-alt',
                columns: 'icon-select',
                export: 'icon-export'
            },
            responseHandler: function (res) {
                $("#dsh").html(res.length);
                return res;
            },
            formatNoMatches: function () { //判断有无数据
                var imghtml = '<div class="flexed_column content_center content_alignCenter padding-20"><img src="https://static.9hive.cn/global/img/nodata.png" class="no_data"/><span class="font-size-16">暂无数据</span></div>';
                return imghtml;
            },
            formatLoadingMessage: function () {  //数据加载中样式
                return ' <div id="loading"><div id="loading-center">' +
                    '<div id="loading-center-absolute"><div class="object" id="object_one">' +
                    '</div><div class="object" id="object_two"></div><div class="object" id="object_three">' +
                    '</div><div class="object" id="object_four"></div></div></div>努力加载中...</div>'
            },
        });

        $('#add').on('click', function (e) {
            location.href = 'add';
        });

        $(".wrapper").tooltip({selector: "[data-toggle=tooltip]", container: "body"});

    })();
</script>
</body>
</html>